//
// Created by wenbo on 24-7-26.
//

#ifndef COM_H
#define COM_H

#include "stdint.h"
#pragma pack(1)
typedef struct
{
    float angle_sensor;
    float motor_pos;
    float motor_speed;
    uint8_t mrc1_state;
    uint8_t mrc2_state;
}VSA_state;//
#pragma pack()

#pragma pack(1)
typedef struct
{
    float motor_pos;
    float motor_speed;
    uint8_t mrc1_state;
    uint8_t mrc2_state;;
}VSA_cmd;
#pragma pack()

/*      msg typedef        */
#pragma pack(1)
typedef struct
{
    uint8_t HEAD[2];//2bytes
    VSA_state state;//14bytes
    uint8_t crc;//1bytes
}VSA2PC_msg;//17bytes
#pragma pack()

#pragma pack(1)
typedef struct
{
    uint8_t HEAD[2];
    VSA_cmd cmd;
    uint8_t crc;
}PC2VSA_msg;
#pragma pack()

extern VSA2PC_msg stateMsg;
extern VSA_state vsa_state;


void pack_n_go(VSA2PC_msg * stateMsg, VSA_state * vsa_state);

#endif //COM_H
